package jamirr;

class TypeArgumentImpl<T>
        extends ArgumentImpl<T>
        implements TypeArgument<T> {

    private final String variableName;

    /**
     * Constructor for where the variable name and argument name are the same.
     *
     * @param type                The type
     * @param name                The name
     * @param declaredAnnotations The declared annotations
     * @param genericTypes        The generic types
     */
    public TypeArgumentImpl(
            Class<T> type,
            String name,
            AnnotationMirror[] declaredAnnotations,
            Argument<?>... genericTypes) {
        super(type, name, declaredAnnotations, genericTypes);
        this.variableName = name;
    }

    /**
     * Constructor for where the variable name and argument name differ.
     *
     * @param type                The type
     * @param name                The name
     * @param variableName        The variable name
     * @param declaredAnnotations The declared annotations
     * @param genericTypes        The generic types
     */
    public TypeArgumentImpl(
            Class<T> type,
            String name,
            String variableName,
            AnnotationMirror[] declaredAnnotations,
            Argument<?>... genericTypes) {
        super(type, name, declaredAnnotations, genericTypes);
        this.variableName = variableName;
    }

    @Override
    public String getVariableName() {
        return variableName;
    }

    @Override
    public boolean isTypeVariable() {
        return true;
    }
}
